#define  _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int  n = 0;
	int a = 1;
	int  h = 0;
	scanf("%ld", &n);
	for (int m = 2; m <= n; m++)
	{
		for (int i = 2; i <= m; i++)
		{
			a *= i;
		}
		h += a;
	}
	printf("%d",h );
	return 0;
}